3、contain 把背景图片扩展至最大尺寸,使宽度或高度完全适应内容区域,保持原来的宽高比例
4、cover 把背景图片扩展至足够大,使背景图片完全覆盖背景区域,背景图片的某些部分无法显示在元素区域。
5、当只设置一个值时,第二个值是auto,图片不会变形,会保持原来的宽高比例
div{
width:150px;height:110px;
background-color:rgba(255,0,0);
background-image:url(css7.03.01.png);
background-image:url(css7.03.01.png);
background-repeat:no-repeat;
background-size:contain
}
返回:
如改成:
width:110px;height:150px;
返回:
width:110px;height:200px;
width:200px;height:100px;